<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wwwApp: utils.php File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">wwwApp
   </div>
   <div id="projectbrief">A web app for workshop organizing, recruitment and qualification</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">utils.php File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><a href="utils_8php_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:afa29bd6ae706ff48d0672dab6f1d44d6"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#afa29bd6ae706ff48d0672dab6f1d44d6">nvl</a> ($value, $default)</td></tr>
<tr class="memitem:af5a443c3e2865cca1791b454d51f779d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#af5a443c3e2865cca1791b454d51f779d">is_assoc</a> (&amp;$array)</td></tr>
<tr class="memitem:a7b4bd12bf068d9640e150f87c020ca87"><td class="memItemLeft" align="right" valign="top">if(!function_exists('lcfirst'))&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a7b4bd12bf068d9640e150f87c020ca87">allCapsToCamelCase</a> ($s)</td></tr>
<tr class="memitem:ad01dc8c7022c9fa3f70d15a6be245490"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#ad01dc8c7022c9fa3f70d15a6be245490">addSiteMenuBox</a> ()</td></tr>
<tr class="memitem:aaa1302eab08781745351124e0f41248f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#aaa1302eab08781745351124e0f41248f">actionHomepage</a> ()</td></tr>
<tr class="memitem:a7d4f1c61b2cbadbeda517c8b2f7f4b20"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a7d4f1c61b2cbadbeda517c8b2f7f4b20">buildTodoElement</a> ($element)</td></tr>
<tr class="memitem:a2ab54400c01863db3d5965f74696a7e6"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a2ab54400c01863db3d5965f74696a7e6">actionApplyAsLecturer</a> ()</td></tr>
<tr class="memitem:a4032cd0f6ee948ed8acdc582ae808a08"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a4032cd0f6ee948ed8acdc582ae808a08">actionApplyAsParticipant</a> ()</td></tr>
<tr class="memitem:a9f2d2ae8476929d1f9d830b1f8b5be11"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a9f2d2ae8476929d1f9d830b1f8b5be11">applyForCurrentWorkshopEdition</a> ($lecturer)</td></tr>
<tr class="memitem:ae585d7559427150fb0cbf88782491f7a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#ae585d7559427150fb0cbf88782491f7a">actionReportBug</a> ()</td></tr>
<tr class="memitem:ab90ddb94196c7ae4d3766da871310e93"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#ab90ddb94196c7ae4d3766da871310e93">actionReportBugForm</a> ()</td></tr>
<tr class="memitem:ac3c7753072342b5278b3c96eca1da3cf"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#ac3c7753072342b5278b3c96eca1da3cf">actionAbout</a> ()</td></tr>
<tr class="memitem:a86acce3c002ca1af709fd1b04f2f82fa"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a> ($name)</td></tr>
<tr class="memitem:a38fb5d075bfc51df1f1e3f00a54ce632"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a38fb5d075bfc51df1f1e3f00a54ce632">actionEditOptions</a> ()</td></tr>
<tr class="memitem:a4fad3693879a205c89b0bda5835695ec"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a4fad3693879a205c89b0bda5835695ec">actionDatabaseRaw</a> ()</td></tr>
<tr class="memitem:a5d84b42e619618444a11590f91486f64"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a5d84b42e619618444a11590f91486f64">arrayToAssoc</a> ($array, $keys)</td></tr>
<tr class="memitem:ae70693a7d9a8484219fe57bdf2d2a46f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a> ($description, $gettext= 'gettext')</td></tr>
<tr class="memitem:a0da0744a927ee4af264f38b1c2fce8bf"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a0da0744a927ee4af264f38b1c2fce8bf">getUpdatedOrder</a> ($name, $headers, $default)</td></tr>
<tr class="memitem:a3c6d6f6ae1d6a16dcf633e15bde46eda"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a3c6d6f6ae1d6a16dcf633e15bde46eda">dbg</a> ($o)</td></tr>
<tr class="memitem:ab8204faef3db5ce2f079c89f6fdb76dc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#ab8204faef3db5ce2f079c89f6fdb76dc">timeToStrAgo</a> ($timestamp)</td></tr>
<tr class="memitem:a16f4dfa58e8647af2e848df3623b628c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a> ($<a class="el" href="template_8php.html#ac3f1fe2bff93b1d2b6f50ecca43e836b">format</a>, $timestamp)</td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ac3c7753072342b5278b3c96eca1da3cf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionAbout </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00308">308</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Credits&#39;</span>);</div>
<div class="line">        ?&gt;</div>
<div class="line">                {{Coders}}: Marcin Wrochna&lt;br/&gt;</div>
<div class="line">                {{Icons}}:</div>
<div class="line">                &lt;ul&gt;</div>
<div class="line">                        &lt;li&gt;&lt;a href=<span class="stringliteral">&quot;http://www.fatcow.com/free-icons/&quot;</span>&gt;FatCow&lt;/a&gt;</div>
<div class="line">                                (Creative Commons Attribution 3.0 License),&lt;/li&gt;</div>
<div class="line">                        &lt;li&gt;&lt;a href=<span class="stringliteral">&quot;http://code.google.com/p/twotiny/&quot;</span>&gt;twotiny&lt;/a&gt; (Artistic License/GPL,</div>
<div class="line">                                support the &lt;a href=&quot;http://mojavemusic.ca/&quot;&gt;Mojave&lt;/a&gt; band)&lt;/li&gt;</div>
<div class="line">                &lt;/ul&gt;</div>
<div class="line">                WYSIWIG editor: &lt;a href=<span class="stringliteral">&quot;http://tinymce.moxiecode.com/&quot;</span>&gt;TinyMCE&lt;/a&gt; (LGPL)&lt;br/&gt;</div>
<div class="line">        &lt;?php</div>
<div class="line">        <span class="comment">// TODO add missing credits (uber-upload, mimetex, see README.txt)</span></div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a2ab54400c01863db3d5965f74696a7e6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionApplyAsLecturer </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00237">237</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;applyAsLecturer&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        <a class="code" href="utils_8php.html#a9f2d2ae8476929d1f9d830b1f8b5be11">applyForCurrentWorkshopEdition</a>(<span class="keyword">true</span>);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a4032cd0f6ee948ed8acdc582ae808a08"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionApplyAsParticipant </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00243">243</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;applyAsParticipant&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        <a class="code" href="utils_8php.html#a9f2d2ae8476929d1f9d830b1f8b5be11">applyForCurrentWorkshopEdition</a>(<span class="keyword">false</span>);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a4fad3693879a205c89b0bda5835695ec"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionDatabaseRaw </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00415">415</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#ae6297fbd3e8fa7cc5feb6411a80deee9">userIs</a>(<span class="stringliteral">&#39;admin&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (isset($_POST[<span class="stringliteral">&#39;query&#39;</span>]))</div>
<div class="line">        {</div>
<div class="line">                $result = $DB-&gt;query($_POST[<span class="stringliteral">&#39;query&#39;</span>]);</div>
<div class="line">                $PAGE-&gt;addMessage(<span class="stringliteral">&#39;Rows affected: &#39;</span>. $result-&gt;affected_rows(), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;b&gt;SELECT result:&lt;/b&gt;&lt;table&gt;&#39;</span>;</div>
<div class="line">                <span class="keywordflow">foreach</span> ($result as $i=&gt;$row)</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;tr&gt;&lt;td&gt;&#39;</span>. $i .<span class="stringliteral">&#39;&lt;/td&gt;&lt;td&gt;&#39;</span>. implode(<span class="stringliteral">&#39;&lt;/td&gt;&lt;td&gt;&#39;</span>,$row) .<span class="stringliteral">&#39;&lt;/td&gt;&lt;/tr&gt;&#39;</span>;</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;/table&gt;&#39;</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $PAGE-&gt;title = <span class="stringliteral">&#39;Database&#39;</span>;</div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>(array(array(<span class="stringliteral">&#39;textarea&#39;</span>, <span class="stringliteral">&#39;query&#39;</span>, <span class="stringliteral">&#39;&lt;b&gt;query&lt;/b&gt;&#39;</span>))); <span class="comment">// TODO deprecated form.</span></div>
<div class="line">        echo $form-&gt;getHTML();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a38fb5d075bfc51df1f1e3f00a54ce632"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditOptions </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00336">336</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editOptions&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Settings&#39;</span>);</div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h3&gt;&#39;</span>. _(<span class="stringliteral">&#39;Current workshops edition&#39;</span>) .<span class="stringliteral">&#39;&lt;/h3&gt;&#39;</span>;</div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>(<a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME             =&gt; TYPE;      tDESCRIPTION;</span></div>
<div class="line"><span class="stringliteral">                begintime        =&gt; timestamp; Workshops\&#39; start time;</span></div>
<div class="line"><span class="stringliteral">                endtime          =&gt; timestamp; Workshops\&#39; finish time;</span></div>
<div class="line"><span class="stringliteral">                importanthours   =&gt; text;      Hours selectable in \&#39;staying time\&#39;, space separated (e.g. type 3 to know how many persons will need accomodation every night, 9 for breakfasts, ...).;</span></div>
<div class="line"><span class="stringliteral">                signupdeadline   =&gt; timestamp; Suggested time for participant-to-workshop signups;</span></div>
<div class="line"><span class="stringliteral">                solvedeadline    =&gt; timestamp; Deadline for solving tasks;</span></div>
<div class="line"><span class="stringliteral">                qualifydeadline  =&gt; timestamp; Deadline for qualification results;</span></div>
<div class="line"><span class="stringliteral">                proposaldeadline =&gt; timestamp; Deadline for proposals (soft);</span></div>
<div class="line"><span class="stringliteral">                acceptdeadline   =&gt; timestamp; Deadline for accepting proposals;</span></div>
<div class="line"><span class="stringliteral">                wikidotdeadline  =&gt; timestamp; Deadline for filling wikidot;</span></div>
<div class="line"><span class="stringliteral">                taskdeadline     =&gt; timestamp; Deadline for writing tasks;</span></div>
<div class="line"><span class="stringliteral">                checkdeadline    =&gt; timestamp; Deadline for checking tasks;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>));</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($form-&gt;submitted())</div>
<div class="line">        {</div>
<div class="line">                $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                {</div>
<div class="line">                        $DB-&gt;editions[<a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>)]-&gt;update($values);</div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Saved.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line">        $form-&gt;columnWidth = <span class="stringliteral">&#39;33%&#39;</span>;</div>
<div class="line">        $form-&gt;values = $DB-&gt;editions[<a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>)]-&gt;assoc($form-&gt;getColumns());</div>
<div class="line">        echo $form-&gt;getHTML();</div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h3&gt;&#39;</span>. _(<span class="stringliteral">&#39;Global settings&#39;</span>). <span class="stringliteral">&#39;&lt;/h3&gt;&#39;</span>;</div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>();</div>
<div class="line">        $options = $DB-&gt;query(<span class="stringliteral">&#39;SELECT * FROM table_options ORDER BY name&#39;</span>);</div>
<div class="line">        <span class="keywordflow">foreach</span> ($options as $r)</div>
<div class="line">        {</div>
<div class="line">                $form-&gt;addRow($r[<span class="stringliteral">&#39;type&#39;</span>], $r[<span class="stringliteral">&#39;name&#39;</span>], $r[<span class="stringliteral">&#39;description&#39;</span>]); <span class="comment">// TODO deprecated form?</span></div>
<div class="line">                $form-&gt;values[$r[<span class="stringliteral">&#39;name&#39;</span>]] = $r[<span class="stringliteral">&#39;value&#39;</span>];</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        $form[<span class="stringliteral">&#39;currentEdition&#39;</span>][<span class="stringliteral">&#39;type&#39;</span>] = <span class="stringliteral">&#39;select&#39;</span>;</div>
<div class="line">        $editions = $DB-&gt;query(<span class="stringliteral">&#39;SELECT edition FROM table_editions&#39;</span>)-&gt;fetch_column();</div>
<div class="line">        <span class="keywordflow">foreach</span> ($editions as $e)</div>
<div class="line">                $form[<span class="stringliteral">&#39;currentEdition&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = array_combine($editions, $editions);</div>
<div class="line">        $form[<span class="stringliteral">&#39;currentEdition&#39;</span>][<span class="stringliteral">&#39;other&#39;</span>] = _(<span class="stringliteral">&#39;use a new number to create a new edition&#39;</span>);</div>
<div class="line">        $form[<span class="stringliteral">&#39;currentEdition&#39;</span>][<span class="stringliteral">&#39;validation&#39;</span>] = <span class="stringliteral">&#39;int&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (isset($form-&gt;values[<span class="stringliteral">&#39;gmailOAuthAccessToken&#39;</span>]))</div>
<div class="line">                $form-&gt;values[<span class="stringliteral">&#39;gmailOAuthAccessToken&#39;</span>] =</div>
<div class="line">                        substr($form-&gt;values[<span class="stringliteral">&#39;gmailOAuthAccessToken&#39;</span>],0, 16) . <span class="stringliteral">&#39;...&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($form-&gt;submitted())</div>
<div class="line">        {</div>
<div class="line">                $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                {</div>
<div class="line">                        $ed = $values[<span class="stringliteral">&#39;currentEdition&#39;</span>];</div>
<div class="line">                        <span class="keywordflow">if</span> (!isset($DB-&gt;editions[$ed]))</div>
<div class="line">                        {</div>
<div class="line">                                $row = $DB-&gt;editions[<a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>)]-&gt;assoc(<span class="charliteral">&#39;*&#39;</span>);</div>
<div class="line">                                $row[<span class="stringliteral">&#39;edition&#39;</span>] = $ed;</div>
<div class="line">                                $DB-&gt;editions[]= $row;</div>
<div class="line">                                $PAGE-&gt;addMessage(sprintf(_(<span class="stringliteral">&#39;Created edition %d.&#39;</span>), $ed), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                        }</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($values as $name=&gt;$value)</div>
<div class="line">                                <span class="keywordflow">if</span> ($DB-&gt;options[$name]-&gt;get(<span class="stringliteral">&#39;type&#39;</span>) != <span class="stringliteral">&#39;readonly&#39;</span>)</div>
<div class="line">                                        $DB-&gt;options[$name] = array(<span class="stringliteral">&#39;value&#39;</span> =&gt; $value);</div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Saved global settings.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;admin setting&#39;</span>);</div>
<div class="line">                        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;editOptions&#39;</span>);</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line">        echo $form-&gt;getHTML();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="aaa1302eab08781745351124e0f41248f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionHomepage </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00047">47</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, $USER;</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Main page&#39;</span>);</div>
<div class="line">        $PAGE-&gt;headerTitle = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line">        echo <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;homepage&#39;</span>);</div>
<div class="line"></div>
<div class="line">        $currentEdition = <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>);</div>
<div class="line">        $row = $DB-&gt;edition_users($currentEdition, $USER[<span class="stringliteral">&#39;uid&#39;</span>]);</div>
<div class="line">        $didApplyAsLecturer = <span class="keyword">false</span>;</div>
<div class="line">        $didApplyAsParticipant = <span class="keyword">false</span>;</div>
<div class="line">        $didQualify = <span class="keyword">false</span>;</div>
<div class="line">        <span class="keywordflow">if</span> ($row-&gt;count())</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> ($row-&gt;get(<span class="stringliteral">&#39;lecturer&#39;</span>))</div>
<div class="line">                        $didApplyAsLecturer = <span class="keyword">true</span>;</div>
<div class="line">                <span class="keywordflow">else</span></div>
<div class="line">                        $didApplyAsParticipant = <span class="keyword">true</span>;</div>
<div class="line">                $didQualify = $row-&gt;get(<span class="stringliteral">&#39;qualified&#39;</span>);</div>
<div class="line">        }</div>
<div class="line">        $didApply = $didApplyAsParticipant || $didApplyAsLecturer;</div>
<div class="line"></div>
<div class="line">        <span class="comment">/* todo-list: participants. */</span></div>
<div class="line">        <span class="comment">// TODO oh the hell with the past tense, use imperative only, easier to translate, manage, and stuff.</span></div>
<div class="line">        $did = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME               =&gt; tNOT_DONE_TEXT; tDONE_TEXT;    tCOMMON_TEXT;                    ACTION;</span></div>
<div class="line"><span class="stringliteral">                applyAsParticipant =&gt; Apply;          You applied;   as a participant.;               applyAsParticipant;</span></div>
<div class="line"><span class="stringliteral">                fillProfile        =&gt; Fill;           You filled;    your profile.;                   editProfile;</span></div>
<div class="line"><span class="stringliteral">                signupForWorkshops =&gt; Sign up;        You signed up; for at least 4 workshop blocks; listPublicWorkshops;</span></div>
<div class="line"><span class="stringliteral">                writeMotLetter     =&gt; Write;          You wrote;     a motivation letter.;            editMotivationLetter;</span></div>
<div class="line"><span class="stringliteral">                solveTasks         =&gt; Solve;          You solved;    qualification tasks;</span></div>
<div class="line"><span class="stringliteral">                qualify            =&gt; Wait for results;  You have been qualified; ;</span></div>
<div class="line"><span class="stringliteral">                fillAdditionalInfo =&gt; Fill;           You filled;    the additional info form.;       editAdditionalInfo;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>);</div>
<div class="line">        $did[<span class="stringliteral">&#39;signupForWorkshops&#39;</span>][<span class="stringliteral">&#39;commonText&#39;</span>] .= <span class="stringliteral">&#39; (&#39;</span>. _(<span class="stringliteral">&#39;preferably before&#39;</span>) .<span class="charliteral">&#39; &#39;</span>.</div>
<div class="line">                <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(_(<span class="stringliteral">&#39;%e %B&#39;</span>), $DB-&gt;editions[$currentEdition]-&gt;get(<span class="stringliteral">&#39;signupdeadline&#39;</span>)) .<span class="stringliteral">&#39;).&#39;</span>;</div>
<div class="line">        $did[<span class="stringliteral">&#39;solveTasks&#39;</span>][<span class="stringliteral">&#39;commonText&#39;</span>] .= <span class="stringliteral">&#39; (&#39;</span>. _(<span class="stringliteral">&#39;before&#39;</span>) .<span class="charliteral">&#39; &#39;</span>.</div>
<div class="line">                <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(_(<span class="stringliteral">&#39;%e %B&#39;</span>), $DB-&gt;editions[$currentEdition]-&gt;get(<span class="stringliteral">&#39;solvedeadline&#39;</span>)) .<span class="stringliteral">&#39;).&#39;</span>;</div>
<div class="line">        $did[<span class="stringliteral">&#39;qualify&#39;</span>][<span class="stringliteral">&#39;commonText&#39;</span>] .= <span class="stringliteral">&#39; (&#39;</span>. _(<span class="stringliteral">&#39;before&#39;</span>) .<span class="charliteral">&#39; &#39;</span>.</div>
<div class="line">                <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(_(<span class="stringliteral">&#39;%e %B&#39;</span>), $DB-&gt;editions[$currentEdition]-&gt;get(<span class="stringliteral">&#39;qualifydeadline&#39;</span>)) .<span class="stringliteral">&#39;).&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $did[<span class="stringliteral">&#39;applyAsParticipant&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = $didApplyAsParticipant;</div>
<div class="line">        $did[<span class="stringliteral">&#39;applyAsParticipant&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = !$didApplyAsLecturer;</div>
<div class="line">        $did[<span class="stringliteral">&#39;fillProfile&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = <a class="code" href="user_2utils_8php.html#a5bbc4a39c360e15b0c00714f18d2082b">assertProfileFilled</a>(<span class="keyword">true</span>);</div>
<div class="line">        $did[<span class="stringliteral">&#39;fillProfile&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>]</div>
<div class="line">                = $did[<span class="stringliteral">&#39;signupForWorkshops&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>]</div>
<div class="line">                = $did[<span class="stringliteral">&#39;writeMotLetter&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>]</div>
<div class="line">                = $did[<span class="stringliteral">&#39;solveTasks&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>]</div>
<div class="line">                = $didApplyAsParticipant;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// Check number of workshops signed up for.</span></div>
<div class="line">        $query = <span class="stringliteral">&#39;SELECT count(*)</span></div>
<div class="line"><span class="stringliteral">                FROM table_workshops w, table_workshop_users wu</span></div>
<div class="line"><span class="stringliteral">                WHERE w.wid=wu.wid AND w.edition=$1 AND wu.uid=$2 AND</span></div>
<div class="line"><span class="stringliteral">                        (wu.participant&gt;=$3) AND w.status&gt;=$4&#39;</span>;</div>
<div class="line">        $DB-&gt;query($query, $currentEdition, $USER[<span class="stringliteral">&#39;uid&#39;</span>],</div>
<div class="line">                <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;candidate&#39;</span>)-&gt;<span class="keywordtype">id</span>, <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>(<span class="stringliteral">&#39;accepted&#39;</span>)-&gt;<span class="keywordtype">id</span>);</div>
<div class="line">        $did[<span class="stringliteral">&#39;signupForWorkshops&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = $DB-&gt;fetch() &gt;= 4;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// Check motivation letter.</span></div>
<div class="line">        $mLetter = $DB-&gt;users[$USER[<span class="stringliteral">&#39;uid&#39;</span>]]-&gt;get(<span class="stringliteral">&#39;motivationletter&#39;</span>);</div>
<div class="line">        $words = str_word_count(strip_tags($mLetter));</div>
<div class="line">        $did[<span class="stringliteral">&#39;writeMotLetter&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = ($words &gt; <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;motivationLetterWords&#39;</span>));</div>
<div class="line">        <span class="keywordflow">if</span> (!$did[<span class="stringliteral">&#39;writeMotLetter&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] &amp;&amp; $words)</div>
<div class="line">                $did[<span class="stringliteral">&#39;writeMotLetter&#39;</span>][<span class="stringliteral">&#39;commonText&#39;</span>] =</div>
<div class="line">                        sprintf(_(<span class="stringliteral">&#39; a longer motivation letter (you wrote %d &lt; %d words)&#39;</span>),</div>
<div class="line">                                $words, <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;motivationLetterWords&#39;</span>));</div>
<div class="line">        <span class="comment">// Check qualification tasks solved.</span></div>
<div class="line">        $DB-&gt;query($query, $currentEdition, $USER[<span class="stringliteral">&#39;uid&#39;</span>],</div>
<div class="line">                <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;accepted&#39;</span>)-&gt;<span class="keywordtype">id</span>, <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>(<span class="stringliteral">&#39;accepted&#39;</span>)-&gt;<span class="keywordtype">id</span>);</div>
<div class="line">        $did[<span class="stringliteral">&#39;solveTasks&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = $DB-&gt;fetch() &gt;= 4;</div>
<div class="line">        $did[<span class="stringliteral">&#39;solveTasks&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = $didApplyAsParticipant &amp;&amp; $did[<span class="stringliteral">&#39;signupForWorkshops&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>];</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        $did[<span class="stringliteral">&#39;qualify&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = $didQualify;</div>
<div class="line">        $didEverything = $did[<span class="stringliteral">&#39;signupForWorkshops&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] &amp;&amp; $did[<span class="stringliteral">&#39;writeMotLetter&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>];</div>
<div class="line">        $did[<span class="stringliteral">&#39;qualify&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = ($didEverything || $didQualify) &amp;&amp; $didApplyAsParticipant;</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($didApply)</div>
<div class="line">        {</div>
<div class="line">                $r = $DB-&gt;users[$USER[<span class="stringliteral">&#39;uid&#39;</span>]]-&gt;assoc(<span class="stringliteral">&#39;pesel,address,telephone,parenttelephone&#39;</span>);</div>
<div class="line">                $isselfcatered = $DB-&gt;edition_users($currentEdition,$USER[<span class="stringliteral">&#39;uid&#39;</span>])-&gt;get(<span class="stringliteral">&#39;isselfcatered&#39;</span>);</div>
<div class="line">                $filled = <span class="keyword">true</span>;</div>
<div class="line">                <span class="keywordflow">if</span> (strlen($r[<span class="stringliteral">&#39;pesel&#39;</span>]) != 11)</div>
<div class="line">                        $filled  = <span class="keyword">false</span>;</div>
<div class="line">                <span class="keywordflow">foreach</span> ($r as $value)</div>
<div class="line">                        <span class="keywordflow">if</span> (strlen($value) &lt; 5)</div>
<div class="line">                                $filled = <span class="keyword">false</span>;</div>
<div class="line">        }</div>
<div class="line">        $did[<span class="stringliteral">&#39;fillAdditionalInfo&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = $didApply &amp;&amp; ($isselfcatered || $filled);</div>
<div class="line">        $did[<span class="stringliteral">&#39;fillAdditionalInfo&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = $did[<span class="stringliteral">&#39;qualify&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] &amp;&amp; $didApplyAsParticipant;</div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h4&gt;&#39;</span>. _(<span class="stringliteral">&#39;Want to participate in workshops only?&#39;</span>) .<span class="stringliteral">&#39;&lt;/h4&gt;&lt;ul class=&quot;todoList&quot;&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#ae6297fbd3e8fa7cc5feb6411a80deee9">userIs</a>(<span class="stringliteral">&#39;registered&#39;</span>))</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;li&gt;&lt;a href=&quot;register&quot;&gt;&#39;</span>. _(<span class="stringliteral">&#39;Create an account&#39;</span>). <span class="stringliteral">&#39;&lt;/a&gt;/&#39;</span>. _(<span class="stringliteral">&#39;log in&#39;</span>) .<span class="stringliteral">&#39;.&lt;/li&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($did as &amp;$d)</div>
<div class="line">                echo <a class="code" href="utils_8php.html#a7d4f1c61b2cbadbeda517c8b2f7f4b20">buildTodoElement</a>($d);</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;/ul&gt;&lt;br/&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="comment">/* todo-list: lecturers. */</span></div>
<div class="line">        $did = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME               =&gt; tNOT_DONE_TEXT; tDONE_TEXT;    tCOMMON_TEXT;          ACTION;</span></div>
<div class="line"><span class="stringliteral">                applyAsLecturer    =&gt; Apply;          You applied;   as a lecturer.;        applyAsLecturer;</span></div>
<div class="line"><span class="stringliteral">                fillProfile        =&gt; Fill;           You filled;    your profile.;         editProfile;</span></div>
<div class="line"><span class="stringliteral">                proposeWorkshop    =&gt; Propose;        You proposed;  a workshop block.;     createWorkshop;</span></div>
<div class="line"><span class="stringliteral">                qualify            =&gt; Wait for preliminary approval; Your workshop block has been preliminarly approved; ;</span></div>
<div class="line"><span class="stringliteral">                writeDescription   =&gt; Write;          You wrote;     a decription for users on wikidot;</span></div>
<div class="line"><span class="stringliteral">                checkTasks         =&gt; ;               ;              ;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>);</div>
<div class="line">        $did[<span class="stringliteral">&#39;proposeWorkshop&#39;</span>][<span class="stringliteral">&#39;commonText&#39;</span>] .= <span class="stringliteral">&#39; (&#39;</span>. _(<span class="stringliteral">&#39;before&#39;</span>) .<span class="charliteral">&#39; &#39;</span>.</div>
<div class="line">                <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(_(<span class="stringliteral">&#39;%e %B&#39;</span>), $DB-&gt;editions[$currentEdition]-&gt;get(<span class="stringliteral">&#39;proposaldeadline&#39;</span>)) .<span class="stringliteral">&#39;).&#39;</span>;</div>
<div class="line">        $did[<span class="stringliteral">&#39;qualify&#39;</span>][<span class="stringliteral">&#39;commonText&#39;</span>] .= <span class="stringliteral">&#39; (&#39;</span>. _(<span class="stringliteral">&#39;before&#39;</span>) .<span class="charliteral">&#39; &#39;</span>.</div>
<div class="line">                <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(_(<span class="stringliteral">&#39;%e %B&#39;</span>), $DB-&gt;editions[$currentEdition]-&gt;get(<span class="stringliteral">&#39;acceptdeadline&#39;</span>)) .<span class="stringliteral">&#39;).&#39;</span>;</div>
<div class="line">        $did[<span class="stringliteral">&#39;writeDescription&#39;</span>][<span class="stringliteral">&#39;commonText&#39;</span>] .= <span class="stringliteral">&#39; (&#39;</span>. _(<span class="stringliteral">&#39;before&#39;</span>) .<span class="charliteral">&#39; &#39;</span>.</div>
<div class="line">                <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(_(<span class="stringliteral">&#39;%e %B&#39;</span>), $DB-&gt;editions[$currentEdition]-&gt;get(<span class="stringliteral">&#39;wikidotdeadline&#39;</span>)) .<span class="stringliteral">&#39;).&#39;</span>;</div>
<div class="line">        $did[<span class="stringliteral">&#39;checkTasks&#39;</span>][<span class="stringliteral">&#39;notDoneText&#39;</span>] =</div>
<div class="line">                sprintf(_(<span class="stringliteral">&#39;Write (before %s) and check solutions to (before %s)&#39;</span>),</div>
<div class="line">                <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(_(<span class="stringliteral">&#39;%e %B&#39;</span>), $DB-&gt;editions[$currentEdition]-&gt;get(<span class="stringliteral">&#39;taskdeadline&#39;</span>)),</div>
<div class="line">                <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(_(<span class="stringliteral">&#39;%e %B&#39;</span>), $DB-&gt;editions[$currentEdition]-&gt;get(<span class="stringliteral">&#39;checkdeadline&#39;</span>)));</div>
<div class="line">        $did[<span class="stringliteral">&#39;checkTasks&#39;</span>][<span class="stringliteral">&#39;doneText&#39;</span>] = _(<span class="stringliteral">&#39;You wrote and checked solutions to&#39;</span>);</div>
<div class="line">        $did[<span class="stringliteral">&#39;checkTasks&#39;</span>][<span class="stringliteral">&#39;commonText&#39;</span>]  = _(<span class="stringliteral">&#39;qualification tasks.&#39;</span>);</div>
<div class="line"></div>
<div class="line">        $did[<span class="stringliteral">&#39;applyAsLecturer&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = $didApplyAsLecturer;</div>
<div class="line">        $did[<span class="stringliteral">&#39;applyAsLecturer&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = !$didApplyAsParticipant;</div>
<div class="line">        $did[<span class="stringliteral">&#39;fillProfile&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = <a class="code" href="user_2utils_8php.html#a5bbc4a39c360e15b0c00714f18d2082b">assertProfileFilled</a>(<span class="keyword">true</span>);</div>
<div class="line">        $did[<span class="stringliteral">&#39;fillProfile&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = $didApplyAsLecturer;</div>
<div class="line">        <span class="comment">// Check if any workshop block has been proposed.</span></div>
<div class="line">        $DB-&gt;query(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                SELECT count(*)</span></div>
<div class="line"><span class="stringliteral">                FROM table_workshops w, table_workshop_users wu</span></div>
<div class="line"><span class="stringliteral">                WHERE w.wid=wu.wid AND w.edition=$1 AND wu.uid=$2 AND wu.participant=$3&#39;</span>,</div>
<div class="line">                $currentEdition, $USER[<span class="stringliteral">&#39;uid&#39;</span>], <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;lecturer&#39;</span>)-&gt;<span class="keywordtype">id</span>);</div>
<div class="line">        $did[<span class="stringliteral">&#39;proposeWorkshop&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = $DB-&gt;fetch() &gt; 0;</div>
<div class="line">        $did[<span class="stringliteral">&#39;proposeWorkshop&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = $didApplyAsLecturer;</div>
<div class="line">        <span class="comment">// Check if any workshop block has been accepted.</span></div>
<div class="line">        <span class="comment">/* $DB-&gt;query(&#39;</span></div>
<div class="line"><span class="comment">                SELECT count(*)</span></div>
<div class="line"><span class="comment">                FROM table_workshops w, table_workshop_users wu</span></div>
<div class="line"><span class="comment">                WHERE w.wid=wu.wid AND w.edition=$1 AND wu.uid=$2 AND wu.participant=$3 AND w.status&gt;=$4&#39;,</span></div>
<div class="line"><span class="comment">                $currentEdition, $USER[&#39;uid&#39;], enumParticipantStatus(&#39;lecturer&#39;)-&gt;id, enumBlockStatus(&#39;accepted&#39;)-&gt;id</span></div>
<div class="line"><span class="comment">        );</span></div>
<div class="line"><span class="comment">        $didGetAccepted = $DB-&gt;fetch() &gt; 0; */</span></div>
<div class="line">        $did[<span class="stringliteral">&#39;qualify&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = $didQualify &amp;&amp; $didApplyAsLecturer;</div>
<div class="line">        $did[<span class="stringliteral">&#39;qualify&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = $did[<span class="stringliteral">&#39;proposeWorkshop&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] &amp;&amp; $didApplyAsLecturer;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// Things that aren&#39;t (TODO: could be) automatically checked.</span></div>
<div class="line">        $did[<span class="stringliteral">&#39;writeDescription&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = null;</div>
<div class="line">        $did[<span class="stringliteral">&#39;writeDescription&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = $did[<span class="stringliteral">&#39;proposeWorkshop&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] &amp;&amp; $didApplyAsLecturer;</div>
<div class="line">        $did[<span class="stringliteral">&#39;checkTasks&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>] = null;</div>
<div class="line">        $did[<span class="stringliteral">&#39;checkTasks&#39;</span>][<span class="stringliteral">&#39;enabled&#39;</span>] = $did[<span class="stringliteral">&#39;qualify&#39;</span>][<span class="stringliteral">&#39;done&#39;</span>];</div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h4&gt;&#39;</span>. _(<span class="stringliteral">&#39;Want to give a workshop block?&#39;</span>) .<span class="stringliteral">&#39;&lt;/h4&gt;&lt;ul class=&quot;todoList&quot;&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#ae6297fbd3e8fa7cc5feb6411a80deee9">userIs</a>(<span class="stringliteral">&#39;registered&#39;</span>))</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;li&gt;&lt;a href=&quot;register&quot;&gt;&#39;</span>. _(<span class="stringliteral">&#39;Create an account&#39;</span>). <span class="stringliteral">&#39;&lt;/a&gt;/&#39;</span>. _(<span class="stringliteral">&#39;log in&#39;</span>) .<span class="stringliteral">&#39;.&lt;/li&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($did as &amp;$d)</div>
<div class="line">                echo <a class="code" href="utils_8php.html#a7d4f1c61b2cbadbeda517c8b2f7f4b20">buildTodoElement</a>($d);</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;/ul&gt;&#39;</span>;</div>
<div class="line">        echo _(<span class="stringliteral">&#39;If more than one lecturer is to give a workshop block, &#39;</span>.</div>
<div class="line">               <span class="stringliteral">&#39;one of them should submit a proposition, &#39;</span>.</div>
<div class="line">               <span class="stringliteral">&#39;and then attach the remaining lecturers.&#39;</span>) .<span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        echo _(<span class="stringliteral">&#39;Wikidot accounts are separate - &#39;</span>.</div>
<div class="line">               <span class="stringliteral">&#39;to edit anything there you\&#39;ll have to use a wikidot account.&#39;</span>);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ae585d7559427150fb0cbf88782491f7a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionReportBug </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00270">270</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, $USER;</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Report a problem&#39;</span>);</div>
<div class="line">        $desc = _(<span class="stringliteral">&#39;Something doesn\&#39;t work like it should? Things are unclear, overcomplicated, &#39;</span>.</div>
<div class="line">                <span class="stringliteral">&#39;ugly, inconvenient? You absolutely have to report this!&#39;</span>) . <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#ae6297fbd3e8fa7cc5feb6411a80deee9">userIs</a>(<span class="stringliteral">&#39;registered&#39;</span>))</div>
<div class="line">                $desc .= <span class="stringliteral">&#39;&lt;small&gt;&#39;</span>. _(<span class="stringliteral">&#39;Write how to contact you, if you expect an answer.&#39;</span>). <span class="stringliteral">&#39;&lt;/small&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">                $desc .= <span class="stringliteral">&#39;&lt;small&gt;&#39;</span>. _(<span class="stringliteral">&#39;By default we\&#39;ll reply by e-mail&#39;</span>) .<span class="stringliteral">&#39; (&#39;</span>. $USER[<span class="stringliteral">&#39;email&#39;</span>] .<span class="stringliteral">&#39;).&lt;/small&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>(array(array(<span class="stringliteral">&#39;textarea&#39;</span>, _(<span class="stringliteral">&#39;problem&#39;</span>), $desc)), <span class="stringliteral">&#39;reportBugForm&#39;</span>); <span class="comment">// TODO deprecated form.</span></div>
<div class="line">        echo $form-&gt;getHTML();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ab90ddb94196c7ae4d3766da871310e93"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionReportBugForm </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00285">285</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $PAGE-&gt;title = <span class="stringliteral">&#39;Zgłoszono problem&#39;</span>;</div>
<div class="line">        $template = <span class="keyword">new</span> <a class="code" href="classSimpleTemplate.html">SimpleTemplate</a>($_SERVER);</div>
<div class="line">        ?&gt;&lt;html&gt;&lt;body&gt;</div>
<div class="line">        Zgłoszono problem na &lt;i&gt;%HTTP_HOST%&lt;/i&gt;:&lt;br/&gt;</div>
<div class="line">        &lt;pre&gt;&lt;?php echo htmlspecialchars($_POST[<span class="stringliteral">&#39;problem&#39;</span>]); ?&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;br/&gt;</div>
<div class="line">        &lt;b&gt;Czas:&lt;/b&gt; &lt;?php echo strftime(<span class="stringliteral">&#39;%F %T (%s)&#39;</span>); ?&gt;&lt;br/&gt;</div>
<div class="line">        &lt;b&gt;HTTP_USER_AGENT:&lt;/b&gt; %HTTP_USER_AGENT%&lt;br/&gt;</div>
<div class="line">        &lt;b&gt;HTTP_REFERER:&lt;/b&gt; %HTTP_REFERER%&lt;br/&gt;</div>
<div class="line">        &lt;b&gt;USER:&lt;/b&gt;&lt;br/&gt;</div>
<div class="line">        &lt;pre&gt;&lt;?php print_r($USER) ?&gt;&lt;/pre&gt;</div>
<div class="line">        &lt;/body&gt;&lt;/html&gt;&lt;?php</div>
<div class="line"></div>
<div class="line">        $message = $template-&gt;finish();</div>
<div class="line">        <a class="code" href="error_8php.html#a1cc8adecfb295ae30b85d90dc5ca3062">errorLog</a>($message); <span class="comment">// Log first, in case of email failure.</span></div>
<div class="line">        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;bugreport&#39;</span>);</div>
<div class="line">        <a class="code" href="email_8php.html#a4d9b10638d7c2d561789ed42890fba01">sendMail</a>(<span class="stringliteral">&#39;Zgłoszono problem&#39;</span>, $message, <a class="code" href="config_8php_8template.html#a161dd3855c85d166da6a623576b28b83">BUGREPORT_EMAIL_ADDRESS</a>, <span class="keyword">true</span>);</div>
<div class="line">        $PAGE-&gt;addMessage(<span class="stringliteral">&#39;Wysłane. Dzięki!&#39;</span>, <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ad01dc8c7022c9fa3f70d15a6be245490"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">addSiteMenuBox </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00036">36</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $PAGE-&gt;addMenuBox(_(<span class="stringliteral">&#39;WWWapp&#39;</span>). <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>), <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                ACTION                           =&gt; tTITLE;           ICON;        bPERM;</span></div>
<div class="line"><span class="stringliteral">                homepage                         =&gt; main page;        house.png;   true;</span></div>
<div class="line"><span class="stringliteral">                http://warsztatywww.wikidot.com/ =&gt; wikidot;          wikidot.gif; true;</span></div>
<div class="line"><span class="stringliteral">                reportBug                        =&gt; report a problem; bug.png;     true;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a7b4bd12bf068d9640e150f87c020ca87"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">if (!function_exists('lcfirst')) allCapsToCamelCase </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$s</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00031">31</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>

<p>Referenced by <a class="el" href="utils_8php_source.html#l00472">parseTable()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        <span class="keywordflow">return</span> lcfirst(str_replace(<span class="charliteral">&#39; &#39;</span>, <span class="stringliteral">&#39;&#39;</span>, ucwords(str_replace(<span class="charliteral">&#39;_&#39;</span>, <span class="charliteral">&#39; &#39;</span>, strtolower($s)))));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a9f2d2ae8476929d1f9d830b1f8b5be11"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">applyForCurrentWorkshopEdition </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$lecturer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00249">249</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>

<p>Referenced by <a class="el" href="utils_8php_source.html#l00237">actionApplyAsLecturer()</a>, and <a class="el" href="utils_8php_source.html#l00243">actionApplyAsParticipant()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, $USER;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($DB-&gt;edition_users(<a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>), $USER[<span class="stringliteral">&#39;uid&#39;</span>])-&gt;count())</div>
<div class="line">        {</div>
<div class="line">                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;You have already been signed up for this year\&#39;s edition.&#39;</span>), <span class="stringliteral">&#39;userError&#39;</span>);</div>
<div class="line">                <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;homepage&#39;</span>);</div>
<div class="line">                <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        $DB-&gt;edition_users[] = array(</div>
<div class="line">                <span class="stringliteral">&#39;edition&#39;</span>   =&gt; <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>),</div>
<div class="line">                <span class="stringliteral">&#39;uid&#39;</span>       =&gt; $USER[<span class="stringliteral">&#39;uid&#39;</span>],</div>
<div class="line">                <span class="stringliteral">&#39;qualified&#39;</span> =&gt; 0,</div>
<div class="line">                <span class="stringliteral">&#39;lecturer&#39;</span>  =&gt; $lecturer ? 1 : 0</div>
<div class="line">        );</div>
<div class="line">        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Signed you up for this year\&#39;s edition.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;homepage&#39;</span>);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a5d84b42e619618444a11590f91486f64"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">arrayToAssoc </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$array</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$keys</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00445">445</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>

<p>Referenced by <a class="el" href="form_8php_source.html#l00032">Form\addRow()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        $result = $array;</div>
<div class="line">        <span class="keywordflow">for</span> ($i = 0; $i &lt; count($keys); $i++)</div>
<div class="line">                <span class="keywordflow">if</span> (array_key_exists($i, $result))</div>
<div class="line">        {</div>
<div class="line">                        $result[$keys[$i]] = $result[$i];</div>
<div class="line">                        unset($result[$i]);</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">return</span> $result;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a7d4f1c61b2cbadbeda517c8b2f7f4b20"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">buildTodoElement </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$element</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00212">212</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>

<p>Referenced by <a class="el" href="utils_8php_source.html#l00047">actionHomepage()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER;</div>
<div class="line">        $done = <span class="keyword">false</span>; $enabled = <span class="keyword">false</span>; $action = null; $doneText = $notDoneText = $commonText = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($element as $key =&gt; $val)</div>
<div class="line">                $$key = $val;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (!empty($action) &amp;&amp; $action != <span class="stringliteral">&#39;editProfile&#39;</span>)</div>
<div class="line">                $enabled = $enabled &amp;&amp; <a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>($action);</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (!is_null($done))</div>
<div class="line">                $class = $enabled ? ($done ? <span class="stringliteral">&#39;done&#39;</span> : <span class="stringliteral">&#39;todo&#39;</span>) : <span class="stringliteral">&#39;disabled&#39;</span>;</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">                $class = $enabled ? <span class="stringliteral">&#39;enabled&#39;</span> : <span class="stringliteral">&#39;disabled&#39;</span>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#ae6297fbd3e8fa7cc5feb6411a80deee9">userIs</a>(<span class="stringliteral">&#39;registered&#39;</span>))</div>
<div class="line">                $class  = <span class="stringliteral">&#39;disabled&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($enabled &amp;&amp; !empty($action))</div>
<div class="line">                $notDoneText = <span class="stringliteral">&quot;&lt;a href=&#39;$action&#39;&gt;$notDoneText&lt;/a&gt;&quot;</span>;</div>
<div class="line">        $result = ($done ? $doneText : $notDoneText) .<span class="charliteral">&#39; &#39;</span>. $commonText;</div>
<div class="line">        $result = <a class="code" href="user_2utils_8php.html#a7144fa5a413ad5690425b7b720aeedba">genderize</a>($result);</div>
<div class="line">        <span class="keywordflow">return</span> <span class="stringliteral">&quot;&lt;li class=&#39;$class&#39;&gt;$result&lt;/li&gt;&quot;</span>;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a3c6d6f6ae1d6a16dcf633e15bde46eda"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">dbg </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$o</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00576">576</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $PAGE-&gt;addMessage(htmlspecialchars(json_encode($o)));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a16f4dfa58e8647af2e848df3623b628c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">fixedStrftime </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$timestamp</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Equal to strftime, but with correctly inflected month names in polish and replaces ago% with <a class="el" href="utils_8php.html#ab8204faef3db5ce2f079c89f6fdb76dc">timeToStrAgo()</a> </p>

<p>Definition at line <a class="el" href="utils_8php_source.html#l00611">611</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>

<p>Referenced by <a class="el" href="utils_8php_source.html#l00047">actionHomepage()</a>, and <a class="el" href="profile_8php_source.html#l00015">actionShowProfile()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        $polish = array(</div>
<div class="line">                <span class="stringliteral">&#39;styczeń&#39;</span>     =&gt; <span class="stringliteral">&#39;stycznia&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;luty&#39;</span>        =&gt; <span class="stringliteral">&#39;lutego&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;marzec&#39;</span>      =&gt; <span class="stringliteral">&#39;marca&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;kwiecień&#39;</span>    =&gt; <span class="stringliteral">&#39;kwietnia&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;maj&#39;</span>         =&gt; <span class="stringliteral">&#39;maja&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;czerwiec&#39;</span>    =&gt; <span class="stringliteral">&#39;czerwca&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;lipiec&#39;</span>      =&gt; <span class="stringliteral">&#39;lipca&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;sierpień&#39;</span>    =&gt; <span class="stringliteral">&#39;sierpnia&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;wrzesień&#39;</span>    =&gt; <span class="stringliteral">&#39;września&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;październik&#39;</span> =&gt; <span class="stringliteral">&#39;października&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;listopad&#39;</span>    =&gt; <span class="stringliteral">&#39;listopada&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;grudzień&#39;</span>    =&gt; <span class="stringliteral">&#39;grudnia&#39;</span></div>
<div class="line">        );</div>
<div class="line">        $format = str_replace(<span class="stringliteral">&#39;%ago%&#39;</span>, <a class="code" href="utils_8php.html#ab8204faef3db5ce2f079c89f6fdb76dc">timeToStrAgo</a>($timestamp), $format);</div>
<div class="line">        <span class="keywordflow">return</span> str_replace(array_keys($polish), array_values($polish), strftime($format, $timestamp));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a86acce3c002ca1af709fd1b04f2f82fa"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">getOption </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$name</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00327">327</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>

<p>Referenced by <a class="el" href="workshop_8php_source.html#l00610">actionAddWorkshopLecturer()</a>, <a class="el" href="admin_8php_source.html#l00036">actionAdminUsers()</a>, <a class="el" href="profile_8php_source.html#l00280">actionEditAdditionalInfo()</a>, <a class="el" href="profile_8php_source.html#l00395">actionEditMotivationLetter()</a>, <a class="el" href="utils_8php_source.html#l00336">actionEditOptions()</a>, <a class="el" href="profile_8php_source.html#l00084">actionEditProfile()</a>, <a class="el" href="admin_8php_source.html#l00124">actionEditUserStatus()</a>, <a class="el" href="workshop_8php_source.html#l00385">actionEditWorkshop()</a>, <a class="el" href="workshop_8php_source.html#l00542">actionEditWorkshopLecturers()</a>, <a class="el" href="utils_8php_source.html#l00047">actionHomepage()</a>, <a class="el" href="summary_8php_source.html#l00132">actionListArrivalData()</a>, <a class="el" href="summary_8php_source.html#l00191">actionListDailyCounts()</a>, <a class="el" href="workshop_8php_source.html#l00026">actionListPublicWorkshops()</a>, <a class="el" href="summary_8php_source.html#l00003">actionShowCorrelation()</a>, <a class="el" href="tasks_8php_source.html#l00344">actionShowPointsTable()</a>, <a class="el" href="profile_8php_source.html#l00015">actionShowProfile()</a>, <a class="el" href="utils_8php_source.html#l00036">addSiteMenuBox()</a>, <a class="el" href="utils_8php_source.html#l00249">applyForCurrentWorkshopEdition()</a>, <a class="el" href="user_2utils_8php_source.html#l00117">getUserRoles()</a>, <a class="el" href="workshop_8php_source.html#l00088">listWorkshops()</a>, <a class="el" href="email_8php_source.html#l00038">sendMail()</a>, <a class="el" href="summary_8php_source.html#l00245">sqlUserIsQualified()</a>, and <a class="el" href="workshop_8php_source.html#l00495">submitEditWorkshopForm()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $option = $DB-&gt;options[$name]-&gt;assoc(<span class="stringliteral">&#39;value, type&#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> ($option[<span class="stringliteral">&#39;type&#39;</span>] == <span class="stringliteral">&#39;int&#39;</span>)</div>
<div class="line">                <span class="keywordflow">return</span> intval($option[<span class="stringliteral">&#39;value&#39;</span>]);</div>
<div class="line">        <span class="keywordflow">return</span> $option[<span class="stringliteral">&#39;value&#39;</span>];</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a0da0744a927ee4af264f38b1c2fce8bf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">getUpdatedOrder </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$headers</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$default</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00549">549</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>

<p>Referenced by <a class="el" href="admin_8php_source.html#l00036">actionAdminUsers()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        $allowed = array();</div>
<div class="line">        <span class="keywordflow">foreach</span> ($headers as $h)</div>
<div class="line">                <span class="keywordflow">if</span> (!empty($h[<span class="stringliteral">&#39;order&#39;</span>]))</div>
<div class="line">                        $allowed[]= $h[<span class="stringliteral">&#39;order&#39;</span>];</div>
<div class="line"></div>
<div class="line">        $name = <span class="stringliteral">&#39;order_&#39;</span>. $name;</div>
<div class="line">        $order = array();</div>
<div class="line">        <span class="keywordflow">if</span> (!empty($_GET[<span class="stringliteral">&#39;order&#39;</span>]))</div>
<div class="line">                <span class="keywordflow">if</span> (in_array($_GET[<span class="stringliteral">&#39;order&#39;</span>], $allowed))</div>
<div class="line">                        $order[]= $_GET[<span class="stringliteral">&#39;order&#39;</span>];</div>
<div class="line">        <span class="keywordflow">if</span> (isset($_SESSION[$name]))</div>
<div class="line">                <span class="keywordflow">foreach</span> ($_SESSION[$name] as $o)</div>
<div class="line">                        <span class="keywordflow">if</span> (in_array($o, $allowed))</div>
<div class="line">                                $order[]= $o;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">while</span> (count($order) &gt; 4)</div>
<div class="line">                array_pop($order);</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (empty($order))</div>
<div class="line">                $order[]= $default;</div>
<div class="line"></div>
<div class="line">        $_SESSION[$name] = $order;</div>
<div class="line">        <span class="keywordflow">return</span> $order;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="af5a443c3e2865cca1791b454d51f779d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">is_assoc </td>
          <td>(</td>
          <td class="paramtype">&amp;&#160;</td>
          <td class="paramname"><em>$array</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00012">12</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">                           {</div>
<div class="line">        $next = 0;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($array as $k=&gt;$v) {</div>
<div class="line">                <span class="keywordflow">if</span> ($k !== $next)</div>
<div class="line">                        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line">                $next++;</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keywordflow">if</span> (!function_exists(<span class="stringliteral">&#39;lcfirst&#39;</span>)) <span class="comment">// PHP &lt; 5.3</span></div>
<div class="line">{</div>
<div class="line">        <span class="keyword">function</span> lcfirst($s)</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">return</span> strtolower(substr($s,0,1)) . substr($s,1);</div>
<div class="line">        }</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="afa29bd6ae706ff48d0672dab6f1d44d6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">nvl </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$default</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00007">7</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        <span class="keywordflow">return</span> is_null($value) ? $default : $value;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ae70693a7d9a8484219fe57bdf2d2a46f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">parseTable </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$description</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$gettext</em> = <code>'gettext'</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00472">472</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>

<p>Referenced by <a class="el" href="admin_8php_source.html#l00036">actionAdminUsers()</a>, <a class="el" href="user_8php_source.html#l00262">actionChangePassword()</a>, <a class="el" href="profile_8php_source.html#l00280">actionEditAdditionalInfo()</a>, <a class="el" href="profile_8php_source.html#l00395">actionEditMotivationLetter()</a>, <a class="el" href="utils_8php_source.html#l00336">actionEditOptions()</a>, <a class="el" href="profile_8php_source.html#l00084">actionEditProfile()</a>, <a class="el" href="tasks_8php_source.html#l00166">actionEditSolution()</a>, <a class="el" href="tasks_8php_source.html#l00086">actionEditTask()</a>, <a class="el" href="tasks_8php_source.html#l00401">actionEditTasksComment()</a>, <a class="el" href="workshop_8php_source.html#l00385">actionEditWorkshop()</a>, <a class="el" href="utils_8php_source.html#l00047">actionHomepage()</a>, <a class="el" href="user_8php_source.html#l00293">actionPasswordReset()</a>, <a class="el" href="user_8php_source.html#l00173">actionRegister()</a>, <a class="el" href="tasks_8php_source.html#l00430">actionShowTaskSolutions()</a>, <a class="el" href="admin_8php_source.html#l00009">addAdminMenuBox()</a>, <a class="el" href="utils_8php_source.html#l00036">addSiteMenuBox()</a>, <a class="el" href="tutoring_8php_source.html#l00011">addTutoringMenuBox()</a>, <a class="el" href="user_8php_source.html#l00146">addUserMenuBox()</a>, <a class="el" href="workshop_8php_source.html#l00010">addWarsztatyMenuBox()</a>, and <a class="el" href="workshop_8php_source.html#l00088">listWorkshops()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        <span class="comment">// Parse line by line.</span></div>
<div class="line">        $rows = explode(<span class="stringliteral">&quot;\n&quot;</span>, $description);</div>
<div class="line">        $result = array();</div>
<div class="line">        $i = 0;</div>
<div class="line">        $headers = array();</div>
<div class="line">        $keyHeader = null;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($rows as $row)</div>
<div class="line">        {</div>
<div class="line">                <span class="comment">// Skip empty lines.</span></div>
<div class="line">                $row = trim($row);</div>
<div class="line">                <span class="keywordflow">if</span> (!strlen($row))</div>
<div class="line">                        <span class="keywordflow">continue</span>;</div>
<div class="line">                <span class="comment">// Parse &quot;key =&gt; field1; field2; field3;&quot; (fields may contain &#39;=&gt;&#39; but may not contain &#39;;&#39;)</span></div>
<div class="line">                $row = explode(<span class="stringliteral">&#39;=&gt;&#39;</span>, $row, 2);</div>
<div class="line">                $key = trim($row[0]);</div>
<div class="line">                $fields = explode(<span class="charliteral">&#39;;&#39;</span>, $row[1]);</div>
<div class="line">                array_pop($fields); <span class="comment">// Empty space after last &#39;;&#39;.</span></div>
<div class="line">                <span class="keywordflow">foreach</span> ($fields as &amp;$field)</div>
<div class="line">                        $field = trim($field);</div>
<div class="line">                <span class="comment">// First row describes key names (headers) and column modifiers.</span></div>
<div class="line">                <span class="keywordflow">if</span> ($i == 0)</div>
<div class="line">                {</div>
<div class="line">                        $keyHeader = <a class="code" href="utils_8php.html#a7b4bd12bf068d9640e150f87c020ca87">allCapsToCamelCase</a>($key);</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($fields as &amp;$h)</div>
<div class="line">                        {</div>
<div class="line">                                <span class="keywordflow">if</span> ($h[0] == <span class="charliteral">&#39;#&#39;</span> || $h[0] == <span class="charliteral">&#39;b&#39;</span> || $h[0] == <span class="charliteral">&#39;t&#39;</span>)</div>
<div class="line">                                {</div>
<div class="line">                                        $h = array(<span class="stringliteral">&#39;name&#39;</span> =&gt; substr($h, 1), <span class="stringliteral">&#39;modifier&#39;</span> =&gt; $h[0]);</div>
<div class="line">                                }</div>
<div class="line">                                <span class="keywordflow">else</span></div>
<div class="line">                                        $h = array(<span class="stringliteral">&#39;name&#39;</span> =&gt; $h, <span class="stringliteral">&#39;modifier&#39;</span> =&gt; <span class="charliteral">&#39; &#39;</span>);</div>
<div class="line">                                $h[<span class="stringliteral">&#39;name&#39;</span>] = <a class="code" href="utils_8php.html#a7b4bd12bf068d9640e150f87c020ca87">allCapsToCamelCase</a>($h[<span class="stringliteral">&#39;name&#39;</span>]);</div>
<div class="line">                                $headers[]= $h;</div>
<div class="line">                        }</div>
<div class="line">                }</div>
<div class="line">                <span class="comment">// Following rows are saved accordingly (fields are modified if header applies,</span></div>
<div class="line">                <span class="comment">// split if they contain &#39;=&gt;&#39;).</span></div>
<div class="line">                <span class="keywordflow">else</span></div>
<div class="line">                {</div>
<div class="line">                        $row = array();</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($fields as $j =&gt; &amp;$field)</div>
<div class="line">                        {</div>
<div class="line">                                <span class="keywordflow">if</span> ($j &lt; count($headers))</div>
<div class="line">                                {</div>
<div class="line">                                        $f = trim($field);</div>
<div class="line">                                        <span class="keywordflow">switch</span> ($headers[$j][<span class="stringliteral">&#39;modifier&#39;</span>])</div>
<div class="line">                                        {</div>
<div class="line">                                                <span class="keywordflow">case</span> <span class="charliteral">&#39;#&#39;</span>:  $f = intval($f); <span class="keywordflow">break</span>;</div>
<div class="line">                                                <span class="keywordflow">case</span> <span class="charliteral">&#39;b&#39;</span>:  $f = $f === <span class="stringliteral">&#39;true&#39;</span> || $f === <span class="charliteral">&#39;1&#39;</span> | $f === <span class="stringliteral">&#39;True&#39;</span>;  <span class="keywordflow">break</span>;</div>
<div class="line">                                                <span class="keywordflow">case</span> <span class="charliteral">&#39;t&#39;</span>:</div>
<div class="line">                                                        <span class="keywordflow">if</span> (empty($f))</div>
<div class="line">                                                                $f = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line">                                                        <span class="keywordflow">else</span> <span class="keywordflow">if</span> ($gettext == <span class="stringliteral">&#39;gettext&#39;</span>)</div>
<div class="line">                                                                $f = gettext($f);</div>
<div class="line">                                                        <span class="keywordflow">else</span></div>
<div class="line">                                                                call_user_func($gettext, $f, $headers[$j][<span class="stringliteral">&#39;name&#39;</span>], $key); <span class="keywordflow">break</span>;</div>
<div class="line">                                        }</div>
<div class="line">                                        $row[$headers[$j][<span class="stringliteral">&#39;name&#39;</span>]] = $f;</div>
<div class="line">                                }</div>
<div class="line">                                <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strpos($field, <span class="stringliteral">&#39;=&gt;&#39;</span>))</div>
<div class="line">                                {</div>
<div class="line">                                        $f = explode(<span class="stringliteral">&#39;=&gt;&#39;</span>, $field, 2);</div>
<div class="line">                                        $row[trim($f[0])] = trim($f[1]);</div>
<div class="line">                                }</div>
<div class="line">                                <span class="keywordflow">else</span></div>
<div class="line">                                        $row[trim($field)] = <span class="keyword">true</span>;</div>
<div class="line">                        }</div>
<div class="line">                        $row[$keyHeader] = $key;</div>
<div class="line">                        $result[$key] = $row;</div>
<div class="line">                }</div>
<div class="line">                $i++;</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">return</span> $result;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ab8204faef3db5ce2f079c89f6fdb76dc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">timeToStrAgo </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$timestamp</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="utils_8php_source.html#l00582">582</a> of file <a class="el" href="utils_8php_source.html">utils.php</a>.</p>

<p>Referenced by <a class="el" href="utils_8php_source.html#l00611">fixedStrftime()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        $s = time() - $timestamp;</div>
<div class="line">        $delay = 1.5;</div>
<div class="line">        <span class="keywordflow">if</span> ($s &lt; $delay * 60)</div>
<div class="line">                <span class="keywordflow">return</span> sprintf(ngettext(<span class="stringliteral">&#39;%d second ago&#39;</span>, <span class="stringliteral">&#39;%d seconds ago&#39;</span>, $s), $s);</div>
<div class="line">        $m = round($s/60);</div>
<div class="line">        <span class="keywordflow">if</span> ($m &lt; $delay * 60)</div>
<div class="line">                <span class="keywordflow">return</span> sprintf(ngettext(<span class="stringliteral">&#39;%d minute ago&#39;</span>, <span class="stringliteral">&#39;%d minutes ago&#39;</span>, $m), $m);</div>
<div class="line">        $h = round($m/60);</div>
<div class="line">        <span class="keywordflow">if</span> ($h &lt; $delay * 24)</div>
<div class="line">                <span class="keywordflow">return</span> sprintf(ngettext(<span class="stringliteral">&#39;%d hour ago&#39;</span>, <span class="stringliteral">&#39;%d hours ago&#39;</span>, $h), $h);</div>
<div class="line">        $d = round($h/24);</div>
<div class="line">        <span class="keywordflow">if</span> ($d &lt; $delay * 7)</div>
<div class="line">                <span class="keywordflow">return</span> sprintf(ngettext(<span class="stringliteral">&#39;%d day ago&#39;</span>, <span class="stringliteral">&#39;%d days ago&#39;</span>, $d), $d);</div>
<div class="line">        $w = round($d/7);</div>
<div class="line">        <span class="keywordflow">if</span> ($d &lt; $delay * 30.5)</div>
<div class="line">                <span class="keywordflow">return</span> sprintf(ngettext(<span class="stringliteral">&#39;%d week ago&#39;</span>, <span class="stringliteral">&#39;%d weeks ago&#39;</span>, $w), $w);</div>
<div class="line">        $n = round($d/30.5);</div>
<div class="line">        <span class="keywordflow">if</span> ($n &lt; $delay * 12)</div>
<div class="line">                <span class="keywordflow">return</span> sprintf(ngettext(<span class="stringliteral">&#39;%d month ago&#39;</span>, <span class="stringliteral">&#39;%d months ago&#39;</span>, $n), $n);</div>
<div class="line">        $y = round($d/365.25);</div>
<div class="line">        <span class="keywordflow">return</span> sprintf(ngettext(<span class="stringliteral">&#39;%d year ago&#39;</span>, <span class="stringliteral">&#39;%d years ago&#39;</span>, $y), $y);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 8 2013 17:44:57 for wwwApp by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.1
</small></address>
</body>
</html>
